# PlaneNavigation.h/.a is the exported file
CC ?= ${CROSS-BULID}gcc
AR ?= ${CROSS-BULID}ar
CFLAGS := -Wall -O2 -I../include `pkg-config --cflags opencv`
LDFLAGS ?= -L../lib -lPlaneNavigation -lpthread `pkg-config --libs opencv`
LIB_PLANENAVIGATION = ../lib/libPlaneNavigation.a
LIBS = ${LIB_PLANENAVIGATION}

PUBLIC_HEADER = ../include/PlaneNavigation.h
OBJS = imgProcess.o demo.o

default: ${LIB_PLANENAVIGATION} ${PUBLIC_HEADER} demo

demo: demo.o imgProcess.o
	g++ ${CFLAGS} -o $@ $^ ${LDFLAGS}

.PHONY: ${LIB_IMGPROCESS} demo
demo.o:
imgProcess.o: imgProcess.cpp imgProcess.hpp
	g++ -c ${CFLAGS} -o $@ $<

${LIB_PLANENAVIGATION}: imgProcess.o
	${AR} rcs $@ $^
${PUBLIC_HEADER}: PlaneNavigation.h
	cp $^ $@

# cleanup
clean:
	${RM} demo
distclean: clean
	${RM} *.o ${LIB_PLANENAVIGATION} ${PUBLIC_HEADER}
